﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Medical.Business;
using Medical.Entity;
using Medical.Data;

/// <summary>
/// 配置信息操作页
/// </summary>
public partial class SetConfigInfo : AdminPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //页面数据初始化
            InitData();
        }
    }

    /// <summary>
    /// 权限控制
    /// </summary>
    /// <returns></returns>
    public override long GetNeededFeatures()
    {
        return AdminFEATURE.Site;
    }

    /// <summary>
    /// 页面数据初始化
    /// </summary>
    protected void InitData()
    {
        //获取配置信息
        ConfigInfo Info = new BisConfigInfo().Get(1);
        if (Info != null)
        {
            txtTitle.Text = Info.Title;
        }

        DataTable dtSeo = new BisSeo().GetList();
        rptSEO.DataSource = dtSeo;
        rptSEO.DataBind();
    }

    /// <summary>
    /// 设置配置信息
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        ConfigInfo Info =new ConfigInfo();
        Info.Title= txtTitle.Text.Trim();
        bool result = new BisConfigInfo().Update(Info);
        if(result)
            Until.config = null;
        Until.Alert(result ? "提交成功！" : "提交失败！");
    }

    protected string GetSeoType(int nType)
    {
        switch (nType)
        {
            case 1:
                return "首页";
            case 2:
                return "医院简介";
            case 3:
                return "专家团队";
            case 4:
                return "前沿技术";
            case 5:
                return "高端设备";
            case 6:
                return "热点专题";
            case 7:
                return "专家答疑";
            case 8:
                return "就诊指南";
            case 9:
                return "症状列表";
            case 10:
                return "成功案例";
            default:
                return "";
        }
    }
}
